<template>
  <div>订单</div>
</template>

<script setup>
import request from "@/assets/js/request";
import { onMounted } from "vue";

const toPay = () => {
  request
    .get("/pay/alipay?shopId=1")
    .then((res) => {
      console.log(res);
      if (res.code === 200) {
        
        // let divForm = document.getElementsByTagName("divform");
        // if (divForm.length) {
        //   document.body.removeChild(divForm[0]);
        // }
        // const div = document.createElement("divform");
        // div.innerHTML = res.data.formDate;
        // document.body.appendChild(div);
        // document.forms[0].setAttribute("target", "_blank");
        // document.forms[0].submit();
      }
    })
    .catch((err) => {
      console.log(err);
    });
};

onMounted(() => {
  console.log("订单页面");
  toPay();
});
</script>

<style></style>
